﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Script.ascx.cs" Inherits="Micronet.OpenWeb.Com.ControlLib.Script" %>
<%@ Import Namespace="Micronet.OpenWeb.Utils" %>
<%@ Import Namespace="Micronet.OpenWeb.Com" %>
<owc:OwWindowManager ID="OwWm" runat="server" MinimizeZoneID="MinimizeWindowZoneDiv">
    <Windows>
        <owc:OwWindow runat="server" ID="DIW" SkinID="DIW">
        </owc:OwWindow>
        <owc:OwWindow runat="server" ID="ASW" SkinID="ASW">
        </owc:OwWindow>
        <owc:OwWindow runat="server" ID="DLW" SkinID="DLW" ToolTip="Dictionary Lookup">
        </owc:OwWindow>
        <owc:OwWindow ID="PCW" runat="server" SkinID="ASW" RestrictionZoneID="RestrictedZone">
        </owc:OwWindow>
        <owc:OwWindow ID="PW" runat="server" SkinID="PW">
        </owc:OwWindow>
    </Windows>
</owc:OwWindowManager>
<asp:HiddenField ID="LanguageFirstPart" runat="server" Value="<%$ Ow: OwCom.OwLanguage2FirstCharaters() %>" />
<owc:OwScriptBlock ID="OwSb" runat="server">
    <script type="text/javascript" src="http://cdn.openweb.vn/Resources/Scripts/OpenWeb.js">
    </script>            
    <script type="text/javascript">
        if (!window.OpenWeb) {
            document.write('<script src="/App_Common/Resources/Scripts/OpenWebLocal.js" type="text/javascript"><\/script>');
        }
        function OwDl() {
            var searchString = "";
            if (window.document.selection) {
                var rng = window.document.selection.createRange(); searchString = rng.text;
            }
            else if (window.getSelection) {
                searchString = window.getSelection().toString();
            }
            if (searchString) {
                var dLanguage = document.getElementById('<%= LanguageFirstPart.ClientID %>').value;
                var urlSearchString = "http://translate.google.com.vn/#auto|" + dLanguage + "|" + searchString;
                var dictionaryWindow = window.radopen(urlSearchString, "DLW"); dictionaryWindow.show(); dictionaryWindow.center();
            }
        }
        function OwPopupWindowResolve(url) {
            var urlToOpen = '<%= string.Format("/{0}/", OwCurrent.Language) %>' + url + "." + '<%= OwPC.PC.UrlExtension %>';
            var owWd = radopen(urlToOpen, urlToOpen);
            owWd.focus();
            return false;
        }
        //use in masterpage
        function Focus(sender, args)
        {
            $('.SearchMyGooSelectSource').stop(true, true).slideUp();
        }
        $(function ()
        {
            $('#SearchMyGooTop').hover(function ()
            {
                $('.SearchMyGooSelectSource').stop(true, true).slideDown();
            }, function ()
            {
                $('.SearchMyGooSelectSource').stop(true, true).slideUp();
            });
        });
        function OwMouseOverTab(sender, eventArgs)
        {
            var multiPageID = sender.get_multiPageID();
            var tab = eventArgs.get_tab();
            sender.set_multiPageID(multiPageID);
            tab.select();
        }     
        //end use in masterpage
        $(document).ready(function () {
            //ShortCuts Scroll:
            $('#GoToTop').click(function () {
                owScrollTo('#Top');
            });
            $('#GoToContent').click(function () {
                owScrollTo('#Content');
            });
            $('#GoToBottom').click(function () {
                owScrollTo('#Bottom');
            });
            function owScrollTo(id) {
                $('html, body').animate({ scrollTop: $(id).offset().top }, 'bounceout');
            };
        });
    </script>
</owc:OwScriptBlock>
